** This arexx script will import the main 24bit image data in
** ImageFX into ImageEngineer. Both programs must be running at
** the same time.
** This script has been tested on ImageFX 1.5
** and requires ImageEngineer 3.0 (or higher).
**
*/
OPTIONS RESULTS
SIGNAL ON ERROR
TEMP_FILE = 't:Image_from_ImageFX'
/* Main code */
IF ~SHOW(PORTS,'IMAGEFX.1') THEN DO
'REQUEST' '"Could not locate ImageFXs arexx port!"' '" OK "'
CALL ErrorOut 10
END
ADDRESS "IMAGEFX.1"
SaveBufferAs ILBM '"'TEMP_FILE'"'
IF (RC ~= 0) THEN DO
ADDRESS 'IMAGEENGINEER'
'REQUEST' '"Failed to save temporary image from ImageFX!"' '" OK "'
CALL ErrorOut 10
END
ADDRESS 'IMAGEENGINEER'
'OPEN' TEMP_FILE 'COLOUR'
IF (RC ~= 0) THEN DO
'REQUEST' '"Failed to load temporary image into IE!"' '" OK "'
CALL ErrorOut 10
END
NEW_IMAGE = RESULT
CALL Errorout 0
/* Errorout procedure */
ErrorOut:
PARSE ARG ExitCode
IF (EXISTS( TEMP_FILE )) THEN DO
ADDRESS COMMAND "Delete >NIL:" TEMP_FILE
END
EXIT ExitCode
/* IE's error procedure */
Error:
if RC=5 then do /* Did the user just cancel us? */
IE_TO_FRONT
LAST_ERROR
'REQUEST "'||RESULT||'"'
exit
end
else do
IE_TO_FRONT
LAST_ERROR
'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'